use tokio::sync::mpsc::Sender;

use crate::protocol_buffer::entity::TransformerApplication;

use super::message::Message;

/**
 * @author Dream-Lab مۇختەرجان مەخمۇت
 * @email ug-project@outlook.com
 * @create date 2022-07-21 14:59:06
 * @modify date 2022-07-21 14:59:06
 * @desc [description]
*/

pub struct TransformerApplicationExtends {
    pub app: TransformerApplication,
    ///Actually this is message pipe's input port.
    pub output: Vec<Sender<Message>>,
    ///Outputs message to pipe
    pub input: Option<Sender<Message>>,
}

impl TransformerApplicationExtends {
    fn new(app: TransformerApplication) -> TransformerApplicationExtends {
        TransformerApplicationExtends { app, input: None, output: vec![] }
    }
}

impl Into<TransformerApplicationExtends> for TransformerApplication {
    fn into(self) -> TransformerApplicationExtends {
        TransformerApplicationExtends::new(self)
    }
}

impl Into<TransformerApplication> for TransformerApplicationExtends {
    fn into(self) -> TransformerApplication {
        self.app
    }
}
